# -*- encoding=utf8 -*-
__author__ = "yangbj"
#运行测试用例

from airtest.core.api import *
from config.usersetting import *
import unittest
# import HtmlTestRunner
from ExtentHTMLTestRunner import HTMLTestRunner
# import os
# import time
# import os

# from appium import webdriver
# from selenium.webdriver.support.ui import WebDriverWait
#  # 初始化appium-desktop
# desired_caps = {}
# # 使用哪种移动平台
# desired_caps['platformName'] = 'Android'
# # Android版本
# desired_caps['platformVersion'] = '6.0'
# # desired_caps['platformVersion'] = '5.1.1'
# # 启动哪种设备，是真机还是模拟器？
# desired_caps['deviceName'] = 'HUAWEI'
# # desired_caps['deviceName'] = 'Meizu MX4 Pro'
# # App的绝对路径
# desired_caps['appPackage'] = 'com.lj.ljshell'
# desired_caps['appActivity'] = '.ljshell'
# # desired_caps['appWaitActivity']='.HOMEWORK'
# # desired_caps['app'] = PATH('D:\kuyu.apk')
#
# driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)  # 初始化
# desired_caps['unicodeKeyboard'] = True,  # 使用unicodeKeyboard的编码方式来发送字符串
# desired_caps['resetKeyboard'] = True  # 将键盘给隐藏起来

# auto_setup(__file__)
# connect_device('Android://TJF6R15C02002273/')
suite = unittest.TestSuite()
# #测试微课
# suite.addTest(Weiclass("test_weiclass"))
# suite.addTest(Weiclass("test_wesendn"))
# suite.addTest(Weiclass("test_wesend"))
#扫描目录测试用例

# suite = unittest.TestLoader().discover("com.ljlx.teacher.script.myclass")
# suite = unittest.TestLoader().discover("com.ljlx.teacher.script.activity")

suite = unittest.TestLoader().discover("src.testcase.teawork")


if __name__ == "__main__":
    #获取报告文件名
    filepath=report_file
    ftp = open(filepath, 'wb')

    runner = HTMLTestRunner(stream=ftp, title='学习通知自动化测试')
    # runner =HTMLTestRunner(stream=ftp, title='安卓自动化测试')
    runner.run(suite)



